#include <bits/stdc++.h>
using namespace std;
const int maxn=200020;
struct point
{
	int st,ed;
}p1[maxn],p2[maxn];
int n,m1,m2;
bool cmp(point x,point y)
{
	return x.st<y.st;
}
int bel[maxn];
struct times
{
	int bel;
	int opt;
	int val;
}t[maxn<<1];
bool cmp2(times x,times y)
{
	return x.val<y.val;
}
int len=0;
int lft;
set<int> s;
int sz1[maxn],sz2[maxn],cnt;
void solve1()
{
	if (!m1) return;
	for (int i=1;i<=m1;i++)
		t[++len].val=p1[i].st,t[len].bel=i,t[len].opt=1,
		t[++len].val=p1[i].ed,t[len].bel=i,t[len].opt=2;
	sort(t+1,t+len+1,cmp2);
	bel[1]=1;
	for (int i=1;i<=len;i++)
	{
		int v=t[i].val,b=t[i].bel;
		if (t[i].opt==1)
		{
			if (!s.size()) bel[b]=++cnt;
			else
			{
				int t=*s.begin();
				bel[b]=t,s.erase(t);	
			}
		}
		else s.insert(bel[b]);
	}
	for (int i=1;i<=m1;i++) sz1[bel[i]]++;
}
void solve2()
{
	s.clear();
	if (!m2) return;
	len=0;
	for (int i=1;i<=m2;i++)
		t[++len].val=p2[i].st,t[len].bel=i,t[len].opt=1,
		t[++len].val=p2[i].ed,t[len].bel=i,t[len].opt=2;
	cnt=0;
	sort(t+1,t+len+1,cmp2);
	bel[1]=1;
	for (int i=1;i<=len;i++)
	{
		int v=t[i].val,b=t[i].bel;
		if (t[i].opt==1)
		{
			if (!s.size()) bel[b]=++cnt;
			else
			{
				int t=*s.begin();
				bel[b]=t,s.erase(t);	
			}
		}
		else s.insert(bel[b]);
	}
	for (int i=1;i<=m2;i++) sz2[bel[i]]++;
}
int main()
{
	freopen("airport.in","r",stdin);
	freopen("airport.out","w",stdout);
	scanf("%d%d%d",&n,&m1,&m2);
	for (int i=1;i<=m1;i++) scanf("%d%d",&p1[i].st,&p1[i].ed);
	for (int i=1;i<=m2;i++) scanf("%d%d",&p2[i].st,&p2[i].ed);
	sort(p1+1,p1+m1+1,cmp),sort(p2+1,p2+m2+1,cmp);
	solve1(),solve2();
	int ans=0;
	for (int i=1;i<=n;i++) sz1[i]+=sz1[i-1];
	for (int i=1;i<=n;i++) sz2[i]+=sz2[i-1];
	for (int i=0;i<=n;i++) ans=max(ans,sz1[i]+sz2[n-i]);
	printf("%d\n",ans);
	fclose(stdin);
	fclose(stdout);
	return 0;
}
